package com.iflytek.view;

import com.iflytek.bean.Emp;
import com.iflytek.dao.impl.EmpDaoImpl;
import com.iflytek.service.EmpService;
import com.iflytek.service.impl.EmpServiceImpl;
import org.junit.Test;

import java.util.List;
import java.util.Scanner;

/*
 *员工管理系统程序入口类
 * liuu33322
 */

public class EmpMain {
    static Scanner sc = new Scanner(System.in);
    static EmpService empService = new EmpServiceImpl();


    /*
     *程序启动入口111
     */
    public static void main(String [] args){
        System.out.println("==========================================");
        System.out.println("========*******员工管理系统*********========");
        System.out.println("==========================================");
        menu();
    }

    /*
     *程序欢迎菜单
     */
    private static void menu() {
        System.out.println("请输入相应操作序号：1.员工列表 2.增加员工 3.修改员工信息 4.删除员工 5.根据员工姓名模糊查询 6.退出");
        int num = sc.nextInt();
                switch (num){
            case 1:
                List<Emp>  empList = empService.getAllEmp();
                for (Emp emp : empList) {
                    System.out.println(emp);
                }
                break;
            case 2:
                List<Emp> empList1 = empService.addEmp(new Emp());
                for (Emp emp : empList1) {
                    System.out.println(emp);
                }
                break;
            case 3:
              empService.upDate( 1017);
                List<Emp> empList2= empService.getAllEmp();
                for (Emp emp : empList2) {
                    System.out.println(emp);
                }
                break;
            case 4:
              empService.delEmpById(1020);
                List<Emp> empList3= empService.getAllEmp();
                for (Emp emp : empList3) {
                    System.out.println(emp);
                }
                break;
            case 5:
                List<Emp> empList4 = empService.selectLikeName("");
                for (Emp emp : empList4) {
                    System.out.println(emp);
                }
                case 6:
                    System.exit(100);
                break;
            default:

        }
    }

}

